﻿package drawer 
{
	import drawer.events.DrawEvent;
	import fab.geom.Circle;
	import fab.geom.Drawer;
	import fab.geom.Segment;
	import fab.geom.Bezier;
	import flash.display.Graphics;

	public class DrawManager 
	{
		private var graphics:Graphics;
		
		public function DrawManager( graphics:Graphics ) 
		{
			this.graphics = graphics;
		}
		public function drawPoint(e:DrawEvent):void 
		{
			Drawer.drawPoint( graphics, e.arg1 )
		}		
		public function drawCircle(e:DrawEvent):void 
		{
			var c:Circle = (e.arg1 as Circle);	
			Drawer.drawCircle( graphics, c.centre, c.rayon );
		}
		public function drawEllipse(e:DrawEvent):void 
		{
			Drawer.drawEllipse( graphics, e.arg1, e.arg2, e.arg3 )
		}
		public function draw_curve(e:DrawEvent):void 
		{
			(e.arg1 as Bezier).draw( graphics, 8, e.arg2 );		
		}
		public function drawRectangle(e:DrawEvent):void 
		{
			//graphics.clear();
			Drawer.drawRectangle( graphics, e.arg1, e.arg2 );		
		}
		public function drawLine(e:DrawEvent):void 
		{
			//graphics.clear();
			Drawer.drawLine( graphics, e.arg1, e.arg2 );		
		}		
		public function drawSegment(e:DrawEvent):void 
		{
			//graphics.clear();
			Drawer.drawSegment( graphics, (e.arg1 as Segment).debut, (e.arg1 as Segment).fin, e.arg2 );		
		}		
	}
}